package me.zhengjie.modules.houseshowscene.domain;

import me.zhengjie.base.CommonModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.modules.houseshow.domain.vo.ValueVo;
import me.zhengjie.modules.houseshowscenehot.domain.HouseShowSceneHot;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Date;
import java.sql.Timestamp;
import java.util.List;

/**
* @author TianI
* @date 2021-12-24
*/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("house_show_scene")
public class HouseShowScene extends CommonModel<HouseShowScene> implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "场景ID")
    @TableId(type= IdType.ASSIGN_ID)
    private String houseShowSceneId;

    @ApiModelProperty(value = "展示配置ID")
    private Long houseShowConfigId;

    @ApiModelProperty(value = "场景名称")
    private String text;

    @ApiModelProperty(value = "场景缩略图")
    private String img;

    @ApiModelProperty(value = "场景详情内容，在场景底部展示，可空")
    private String detail;

    @ApiModelProperty(value = "视野水平高度，默认150")
    private Integer hfov;

    @ApiModelProperty(value = "X轴（左耳到右耳）旋转（正数往上，负数往下），默认2")
    private Integer pitch;

    @ApiModelProperty(value = "y轴（从脚到头）旋转，默认360")
    private Integer yaw;

    @ApiModelProperty(value = "场景类型 cubemap 六张图片组合成全景 panorama 一张全景图片")
    private String type;

    @ApiModelProperty(value = "当场景类型为panorama是必填，存储单张全景图路径")
    private String panorama;

    @ApiModelProperty(value = "当场景类型为cubemap时必填，数据类型为json数组，图片顺序为前、右、后、左、上、下，顺序不允许颠倒")
    private String cubeMap;

    @ApiModelProperty(value = "更新时间")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private Date updateTime;
    @TableField(exist = false)
    private ValueVo valueVo;

    @TableField(exist = false)
    private Boolean hotSpotDebug;
    @TableField(exist = false)
    private List<HouseShowSceneHot> hotSpots;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill= FieldFill.INSERT)
    private Date createTime;

    public void copyFrom(HouseShowScene source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
